package o;

import com.huawei.appmarket.service.store.awk.bean.HorizontalCourseItemCardBean;
import java.math.RoundingMode;
import java.text.DecimalFormat;
import o.ewm.i;

public class eim {
    public static String ˏ(long j, HorizontalCourseItemCardBean horizontalCourseItemCardBean) {
        boolean z = horizontalCourseItemCardBean.ʻˊ() == 1;
        if (!"zh".equals(dok.ᐝ()) && !"bo".equals(dok.ᐝ()) && !"ug".equals(dok.ᐝ())) {
            return ˎ(j, z);
        }
        if (((float) j) < 10000.0f) {
            return ContentManager.getInstant().getContext().getResources().getQuantityString(z ? i.ˊॱ : i.ʻॱ, (int) j, new Object[]{ˊ((double) j)});
        } else if (j < 10000000) {
            r4 = (double) (((float) j) / 10000.0f);
            r3 = ˊ(r4);
            return ContentManager.getInstant().getContext().getResources().getQuantityString(z ? i.ͺ : i.ॱˎ, (int) r4, new Object[]{r3});
        } else if (((double) j) < 1.0E8d) {
            return ContentManager.getInstant().getContext().getResources().getQuantityString(z ? i.ͺ : i.ॱˎ, (int) (j / 10000), new Object[]{ˊ((double) (j / 10000))});
        } else {
            r4 = ((double) j) / 1.0E8d;
            r3 = ˊ(r4);
            return ContentManager.getInstant().getContext().getResources().getQuantityString(z ? i.ˏॱ : i.ॱˋ, (int) r4, new Object[]{r3});
        }
    }

    private static String ˎ(long j, boolean z) {
        double d;
        int ॱ;
        String ˊ;
        if (((double) j) >= 1.0E9d) {
            d = ((double) j) / 1.0E9d;
            ॱ = ॱ(d);
            ˊ = ˊ(d);
            return ContentManager.getInstant().getContext().getResources().getQuantityString(z ? i.ˏॱ : i.ॱˋ, ॱ, new Object[]{ˊ});
        } else if (((double) j) >= 1000000.0d) {
            d = ((double) j) / 1000000.0d;
            ॱ = ॱ(d);
            ˊ = ˊ(d);
            return ContentManager.getInstant().getContext().getResources().getQuantityString(z ? i.ॱˊ : i.ॱᐝ, ॱ, new Object[]{ˊ});
        } else if (((float) j) >= 1000.0f) {
            d = (double) (((float) j) / 1000.0f);
            ॱ = ॱ(d);
            ˊ = ˊ(d);
            return ContentManager.getInstant().getContext().getResources().getQuantityString(z ? i.ͺ : i.ॱˎ, ॱ, new Object[]{ˊ});
        } else {
            return ContentManager.getInstant().getContext().getResources().getQuantityString(z ? i.ˊॱ : i.ʻॱ, (int) j, new Object[]{Long.valueOf(j)});
        }
    }

    private static int ॱ(double d) {
        int ceil = (int) Math.ceil(d);
        if (d >= 1.0d || d <= 0.0d) {
            return ceil;
        }
        return 2;
    }

    private static String ˊ(double d) {
        String str;
        if (((int) ((d * 10.0d) % 10.0d)) == 0) {
            str = "#,###";
        } else {
            str = "#,###.0";
        }
        DecimalFormat decimalFormat = new DecimalFormat(str);
        decimalFormat.setRoundingMode(RoundingMode.FLOOR);
        return decimalFormat.format(d);
    }
}
